<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1.使用构造函数来创建
        // var fun = new Function("console.log('hello world!!');");
        // console.log(typeof fun);
        // fun();

        //2.使用函数声明来创建
        // function fun2(){
        //     console.log('hello world!!');
        //     for(var n=1;n<=3;n++){
        //         console.log(n)
        //     }
        // }
        // fun2();

        //3.使用函数表达式来创建
        var fun3 = function(){
            console.log('hello world!!');
            var i=0;
            while(i<5){
                i ++;
                console.log(i);
            }
        };
        fun3();


    </script>
</head>
<body>
    
</body>
</html>